From 8479ea8d77b285ad7dd89ecda74b22a8ff4b0a6f Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Tue, 23 Aug 2005 13:29:48 +0000 Subject: [PATCH] indentation, commenta and other cleanups --- ChangeLog | 10 ++++++++++ babl/babl-classes.c | 4 ++++ babl/babl-classes.h | 22 +++++++++++----------- babl/babl-conversion.c | 1 + babl/babl-fish.h | 28 ++++++++++++++-------------- babl/babl-image.c | 37 ++----------------------------------- babl/babl-image.h | 18 +++++++++--------- babl/babl-instance.h | 8 ++++---- babl/babl-internal.c | 4 ++++ 9 files changed, 59 insertions(+), 73 deletions(-) diff --git a/ChangeLog b/ChangeLog index 18652ad..8e37f08 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-08-23 Øyvind Kolås + + * babl/babl-classes.c, + * babl/babl-classes.h, + * babl/babl-conversion.c, + * babl/babl-fish.h, + * babl/babl-image.c, + * babl/babl-image.h, + * babl/babl-instance.h: Indentation, comments and other cleanup. + 2005-08-23 Øyvind Kolås * docs/index-static.html.in: update webdocs. diff --git a/babl/babl-classes.c b/babl/babl-classes.c index 5b278bf..8f2376d 100644 --- a/babl/babl-classes.c +++ b/babl/babl-classes.c @@ -47,5 +47,9 @@ babl_class_name (BablClassType klass) return class_names[klass-BABL_INSTANCE]; } +/* global variable, indicating whether name lookups + * are frowned upon or not (they are frowned upon within BablBase, + * since that leads to more strings than neccesary in the library.) + */ int babl_hmpf_on_name_lookups = 0; diff --git a/babl/babl-classes.h b/babl/babl-classes.h index 727be57..8bd024d 100644 --- a/babl/babl-classes.h +++ b/babl/babl-classes.h @@ -160,22 +160,22 @@ typedef struct typedef struct { - BablInstance instance; + BablInstance instance; BablConversion **from; /*< NULL terminated list of conversions from class */ BablConversion **to; /*< NULL terminated list of conversions to class */ - int horizontal; - int vertical; - char name[4]; + int horizontal; + int vertical; + char name[4]; } BablSampling; typedef struct { - BablInstance instance; + BablInstance instance; BablConversion **from; /*< NULL terminated list of conversions from class */ BablConversion **to; /*< NULL terminated list of conversions to class */ - int luma; - int chroma; - int alpha; + int luma; + int chroma; + int alpha; } BablComponent; @@ -213,9 +213,9 @@ typedef struct typedef struct { - BablInstance instance; - union Babl *source; - union Babl *destination; + BablInstance instance; + union Babl *source; + union Babl *destination; } BablFish; diff --git a/babl/babl-conversion.c b/babl/babl-conversion.c index 7b6f668..0c5ccd5 100644 --- a/babl/babl-conversion.c +++ b/babl/babl-conversion.c @@ -264,6 +264,7 @@ babl_conversion_process (BablConversion *conversion, void *destination, long n) { + /*TODO: build planar formats if needed when linear pointers are passed in */ assert (BABL_IS_BABL (conversion)); switch (BABL(conversion)->class_type) diff --git a/babl/babl-fish.h b/babl/babl-fish.h index 087146a..ad5235f 100644 --- a/babl/babl-fish.h +++ b/babl/babl-fish.h @@ -24,24 +24,24 @@ BABL_DEFINE_CLASS_NO_NEW_NO_ID(babl_fish) -Babl * -babl_fish (Babl *source, - Babl *destination); +/** create a new BablFish capable of translating between the pixel + * formats given in source and destination. (use babl_pixel_format (string)) + */ +Babl * babl_fish (Babl *source, + Babl *destination); -/* babl_fish_process will probably be a polymorph function - * accepting source and destination buffer pointers will be - * allowed as well as BablImage objects in their place +/* Transform n pixels from source into destination, + * source and destination can be pointers to linear buffers + * (or at a later stage of babl development BablImages) */ -int -babl_fish_process (Babl *babl_fish, - void *source, - void *destination, - int n); +int babl_fish_process (Babl *babl_fish, + void *source, + void *destination, + int n); /* whether the BablFish needs a BablImage to do the processing, - * or void * are sufficient. + * or a void pointer to a linear buffer is sufficient. */ -int -babl_fish_needs_image (Babl *babl_fish); +int babl_fish_needs_image (Babl *babl_fish); #endif diff --git a/babl/babl-image.c b/babl/babl-image.c index da20415..831925c 100644 --- a/babl/babl-image.c +++ b/babl/babl-image.c @@ -28,19 +28,6 @@ #define BABL_MAX_BANDS 32 -static BablImage *db[100]={NULL,}; - -#if 0 -static int -each_babl_image_destroy (Babl *babl, - void *data) -{ - babl_free (babl); - - return 0; /* continue iterating */ -} -#endif - static Babl * image_new (int bands, BablComponent **component, @@ -61,7 +48,6 @@ image_new (int bands, babl->image.data = ((void *)babl->image.component) + sizeof (BablComponent*) * (bands+1); babl->image.pitch = ((void *)babl->image.data) + sizeof (void*) * (bands+1); babl->image.stride = ((void *)babl->image.pitch) + sizeof (int) * (bands+1); -/*babl->image.foo = ((void *)babl->image.stride) + sizeof (int) * (bands+1);*/ babl->class_type = BABL_IMAGE; babl->instance.id = 0; @@ -212,33 +198,14 @@ babl_image_new (void *first, return babl; } -void -babl_image_each (BablEachFunction each_fun, - void *user_data) -{ - int i; - return; - - while (db[i]) - { - if (each_fun ((Babl *) (db[i]), user_data)) - { - return; - } - else - { - i++; - } - } -} - - void babl_image_destroy (void) { + /* nothing to do */ } void babl_image_init (void) { + /* nothing to do */ } diff --git a/babl/babl-image.h b/babl/babl-image.h index fc33e0e..6115750 100644 --- a/babl/babl-image.h +++ b/babl/babl-image.h @@ -22,19 +22,19 @@ #include "babl-classes.h" -void babl_image_init (void); -void babl_image_introspect (void); -void babl_image_each (BablEachFunction each_fun, - void *user_data); -void babl_image_destroy (void); -Babl * babl_image_new (void *first_component, +/* babl images are allocated as a single chunk of memory, and + * thus can be duplicated using duplicate = babl_dup (original); + * + * NB: babl_fish_process () frees the images passed in by itself. + */ +Babl * babl_image_new (void *first_component, ...); /* create a new BablImage based on a packed BablPixelFormat (or BablModel which * is a virtual pixelformat based on the BablModel using only doubles in the * order they are listed in the model. */ -Babl * -babl_image_new_from_linear (void *buffer, - Babl *format); +Babl * babl_image_new_from_linear (void *buffer, + Babl *format); + #endif diff --git a/babl/babl-instance.h b/babl/babl-instance.h index 17f246e..34ee026 100644 --- a/babl/babl-instance.h +++ b/babl/babl-instance.h @@ -10,8 +10,8 @@ typedef int (*BablEachFunction) (Babl *entry, * headers to a minimum, only the ones overriding the basic api with * custom ways of construction. */ -#define BABL_DEFINE_CLASS(type_name) \ - \ +#define BABL_DEFINE_CLASS(type_name) \ + \ void type_name##_init (void); \ void type_name##_destroy (void); \ void type_name##_each (BablEachFunction each_fun, \ @@ -20,8 +20,8 @@ Babl * type_name (const char *name); \ Babl * type_name##_id (int id); \ Babl * type_name##_new (const char *name, \ ...); -#define BABL_DEFINE_CLASS_NO_NEW_NO_ID(type_name) \ - \ +#define BABL_DEFINE_CLASS_NO_NEW_NO_ID(type_name) \ + \ void type_name##_init (void); \ void type_name##_destroy (void); \ void type_name##_each (BablEachFunction each_fun, \ diff --git a/babl/babl-internal.c b/babl/babl-internal.c index 5b278bf..8f2376d 100644 --- a/babl/babl-internal.c +++ b/babl/babl-internal.c @@ -47,5 +47,9 @@ babl_class_name (BablClassType klass) return class_names[klass-BABL_INSTANCE]; } +/* global variable, indicating whether name lookups + * are frowned upon or not (they are frowned upon within BablBase, + * since that leads to more strings than neccesary in the library.) + */ int babl_hmpf_on_name_lookups = 0; -- 2.30.2